package cn.ad.enumration;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

/**
 * User: shirongkang
 * Date: 2016/12/7
 * Time: 14:32
 * Desc:
 */
public enum PlacementTypeEnum {
    PLACEMENT_TYPE_BANNER("PLACEMENT_TYPE_BANNER","Banner"),//Banner广告
    PLACEMENT_TYPE_INLINE("PLACEMENT_TYPE_INLINE","插屏"),//插屏广告
    PLACEMENT_TYPE_SPLASH("PLACEMENT_TYPE_SPLASH","开屏"),//开屏广告
    PLACEMENT_TYPE_FEEDS("PLACEMENT_TYPE_FEEDS","Feeds广告"),//Feeds广告
    PLACEMENT_TYPE_NATIVE("PLACEMENT_TYPE_NATIVE","原生广告");//原生广告

	private String value;
    private String description;
    private static LinkedHashMap<String,String> mappings;
    private static List<Dropdown> list;
    private synchronized static LinkedHashMap<String,String> getMappings() {
        if (mappings == null) {
            mappings = new java.util.LinkedHashMap<>();
            for (PlacementTypeEnum format : PlacementTypeEnum.values()) {
            	mappings.put(format.value, format.description);
            }
        }
        return mappings;
    }
    public static LinkedHashMap<String,String> getMapping(){
        return getMappings();
    }
    private PlacementTypeEnum(String value, String description) {
        this.description = description;
        this.value = value;
    }
    public String getDescription() {
        return this.description;
    }
    
    public String getValue() {
		return value;
	}
	public static List<Dropdown> getListModel(){
        return getList();
    }
    
    private synchronized static List<Dropdown> getList() {
        if (list == null) {
            list = new ArrayList<>();
            for (PlacementTypeEnum format : PlacementTypeEnum.values()) {
            	list.add(new Dropdown(format.value, format.description));
            }
        }
        return list;
    }
}